<?php
namespace app\common\model;

use think\Model;

class User extends BaseModel   //model层 数据添加到数据库
{
     public function add($data = []){
		 if(!is_array($data)){
			 exception('传递数据不是数组');
			 }
		 
		 
		 $data['status'] = 1;
	    return $this->allowField(true)->save($data);
		//return $this->id;
		 
		 } 
		
		//根据用户名获取用户信息  
		public function getUserByUsername($username){
			if(!$username){
				exception('用户名不合法');
				}
			$data = ['username' => $username];
			return $this->where($data)->find();
			
			}

         












}